<template>
  <div class="max">
    <div v-for="item in mySong" :key="item.id" class="geDan">
      <div class="imgs" @click="$router.push({ path: `/playlist/${item.id}` })">
        <i class="iconfont icon-24gf-playCircle" />
        <img :src="item.coverImgUrl">
      </div>
      <div
        class="introduce"
        @click="$router.push({ path: `/playlist/${item.id}` })"
      >
        <div class="name_top">{{ item.name }}</div>
        <div class="name_button">{{ item.creator.nickname }}</div>
      </div>
    </div>
  </div>
</template>

<script>
import { mapState } from 'vuex'
import { getPlaylist } from '@/api/MS/index.js'
export default {
  data() {
    return {
      createTime: null,
      mySong: {}
    }
  },
  computed: {
    ...mapState(['userInfo'])
  },
  created() {
    this.getPlaylist()
  },
  mounted() {},
  methods: {
    // 获取用户歌单
    async getPlaylist() {
      const uid = this.userInfo.id
      const { data } = await getPlaylist({
        uid: uid
      })
      this.mySong = data.playlist
      this.createTime = data.playlist[0].id
      // console.log(this.createTime)
      // console.log(data)
      console.log(this.mySong)
      console.log(this.mySong.shift())
    }
  }
}
</script>

<style scoped lang="less">
.max {
  display: flex;
  flex-wrap: wrap;
  .geDan {
    width: 20%;
    height: 220px;
    .imgs {
      width: 150px;
      transition: all 0.1s;
      position: relative;
      height: 150px;
      border-radius: 10px;
      overflow: hidden;
      i {
        display: none;
        font-size: 40px;
        position: absolute;
        top: 50%;
        left: 50%;
        // backdrop-filter: blur(8px);
        // background: hsla(0, 0%, 100%, 0.14);
        color: rgba(192, 189, 189, 0.836);
        transform: translate(-50%, -50%);
        border-radius: 50%;
        padding: 0;
      }
      img {
        height: 150px;
      }
    }
    .imgs:hover {
      width: 150px;
      box-shadow: 2px 12px 13px #887f7f82;
    }
    .imgs:hover i {
      display: block;
    }
    .introduce {
      margin-top: 10px;
      .name_top {
        width: 150px;
        word-break: break-all;
        font-weight: 600;
        font-size: 16px;
        color: #000;
      }
      .name_top:hover {
        text-decoration: underline;
        cursor: pointer;
      }
      .name_button {
        width: 150px;
        font-size: 12px;
        word-break: break-word;
      }
    }
  }
}
</style>
